import { createSSRApp } from 'vue'
import App from './App.vue'
import { createPinia } from 'pinia'
import { createUnistorage } from 'pinia-plugin-unistorage'
import uniEasyinput from '@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput.vue'
import uniForms from '@dcloudio/uni-ui/lib/uni-forms/uni-forms.vue'
import uniFormsItem from '@dcloudio/uni-ui/lib/uni-forms-item/uni-forms-item.vue'
import uniCountdown from '@dcloudio/uni-ui/lib/uni-countdown/uni-countdown.vue'
import uniIcons from '@dcloudio/uni-ui/lib/uni-icons/uni-icons.vue'

export function createApp() {
	const app = createSSRApp(App)

	// 创建 pinia 实例
	const pinia = createPinia()

	pinia.use(createUnistorage())
	// 注入 pinia
	app.use(pinia)

	app.component('uni-easyinput', uniEasyinput)
	app.component('uni-forms', uniForms)
	app.component('uni-forms-item', uniFormsItem)
	app.component('uni-countdown', uniCountdown)
	app.component('uni-icons', uniIcons)

	return {
		app
	}
}
